<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich" xml:lang="en">
<head>
<title>问题编辑</title>
<meta http-equiv="keywords" content="enter,your,keywords,here" />
<meta http-equiv="description"
	content="A short description of this page." />
<link
	href="#{facesContext.externalContext.requestContextPath}/css/public.css"
	rel="stylesheet" type="text/css" media="screen" />
<link
	href="#{facesContext.externalContext.requestContextPath}/css/main.css"
	rel="stylesheet" type="text/css" media="screen" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- rich:message style-->
<style type="text/css">
	.rich-message-label{
		color:red;
	}
</style>
</head>
<body style="background-color: #ffffff">
<script type="text/javascript">		
	function submit(obj) {
		var selectedbValue = obj.value;
		if (selectedbValue == "1") {
			document.getElementById("subArea").style.display = 'none';
		} else if (selectedbValue == "2") {
			document.getElementById("subArea").style.display = '';
		} else if (selectedbValue == "3") {
			document.getElementById("subArea").style.display = '';
		} else{
			document.getElementById("subArea").style.display = 'none';
		}	
	}
</script>
<h:form>
	<div id="right">
	<div id="msgid" class="error pt10p bcf c0 tal" style="display: ">
	<a4j:outputPanel id="msgPanel">
		<center><h:outputText styleClass="cff"
			value="#{SubjectBB.msg}" /></center>
	</a4j:outputPanel></div>
	<div class="tablelist">
	<table width="100%" border="1" cellpadding="0" cellspacing="0"
		bordercolor="#c3c3c3" style="border-collapse: collapse">
		<tr>
			<td><span class="cff">*</span>OFFICE<h:selectOneMenu
				class="style_input" value="#{SubjectBB.questionsbank.office_code}">
				<f:selectItems value="#{otherParamBB.selectItems_officeInfId}" />
			</h:selectOneMenu></td>
			<td><span class="cff">*</span>技能组<h:selectOneMenu id="tp_userkind"
				class="style_input" value="#{SubjectBB.questionsbank.tp_userkind}">
				<!-- 数据库不能插入null，如需插入空值，需该数据库 -->
				<f:selectItems value="#{paramBB.selectItems_param}" />
			</h:selectOneMenu></td>
			<td><span class="cff">*</span>题目类别<h:selectOneMenu
							class="style_input" value="#{SubjectBB.questionsbank.tp_classid}">
							<f:selectItem itemValue="0" itemLabel="--请选择题目类别--" />
							<f:selectItems value="#{otherParamBB.selectItems_questionClasss}" />
						</h:selectOneMenu></td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td><rich:message for="tp_del_flag" showSummary="true" showDetail="false" /></td>
		</tr>
		<tr>
			<td class="yellow"><span class="cff">*</span>题目类型 <h:selectOneMenu class="style_input"
				onchange="submit(this);" valueChangeListener="#{SubjectBB.subjectChanged}"  
				value="#{SubjectBB.questionsbank.tp_question_type}" immediate="true">
				<f:selectItem itemValue="0" itemLabel="--请选择题类型--" />
				<f:selectItems value="#{paramBB.selectItem['tp_question_type']}" />
			</h:selectOneMenu></td>
			<td><span class="cff">*</span> 难易程度<h:selectOneMenu
				class="style_input" value="#{SubjectBB.questionsbank.tp_difficulty}">
				<f:selectItems value="#{paramBB.selectItem['tp_difficulty']}" />
			</h:selectOneMenu></td>
			<td class="yellow"><span class="cff">*</span>分 值 <label><h:inputText
				class="style_input" value="#{SubjectBB.questionsbank.tp_point}"  disabled="true"/></label></td>
		</tr>
		<tr id="tr_id" style="display: #{SubjectBB.tags==1? 'block':'none'}"> 
			<td align="right"><span class="cff">*</span>答案代码
				<h:inputText id="tp_answer_code" class="style_input" value="#{SubjectBB.questionsbank.tp_answer_code}" />　　　　(判断题：1为对，2为错)
			</td>
			<td><span class="notice"><rich:message for="tp_answer_code" showSummary="true" showDetail="false" /></span></td>
			<td></td>
		</tr>
		</table>
		<table>
		<tr>
			<td><span class="cff">*</span>题 目 </td><td>
			<h:inputTextarea id="tp_question" required="true" value="#{SubjectBB.questionsbank.tp_question}" class="style_textarea">
				<f:validateLength minimum="2" maximum="200" /></h:inputTextarea></td><td>
				<span class="notice"><rich:message for="tp_question" showSummary="true" showDetail="false" /></span>
			</td>
		</tr>
		<tr style="display: #{SubjectBB.tags==4? 'block':'none'}">
			<td></td><td>
				<h:outputText   value="【友情提示：填空题    1个半角下划线'_'代表1个填空，全角下划线'＿'正常显示不代表填空】" />
			</td>
		</tr>
		<tr>
			<td ><span class="cff">*</span> 答案描述 </td><td>
			<h:inputTextarea id="tp_answer" required="true" value="#{SubjectBB.questionsbank.tp_answer}"
				class="style_textarea">
				<f:validateLength maximum="200" />
				<rich:ajaxValidator event="onblur" />
				</h:inputTextarea></td><td>
			<span class="style_textarea"><rich:message for="tp_answer" showSummary="true" showDetail="false" /></span>
			</td>
		</tr>
		<tr>
			<td>备注 </td><td>
			<h:inputTextarea id="tp_e_remark" value="#{SubjectBB.questionsbank.tp_e_remark}"
				class="style_textarea">
				<f:validateLength maximum="200" />
				<rich:ajaxValidator event="onblur" />
				</h:inputTextarea> </td><td>
			<span class="style_textarea"><rich:message for="tp_e_remark" showSummary="true" showDetail="false" /></span>
			</td>
		</tr>
	</table>
	
	<div id="subArea" style="display: #{SubjectBB.tags==2||SubjectBB.tags==3? 'block':'none'}">
	<div class="biaoqian" style="height: 3px; width: 100%">
	<center>添加选择题备选答案</center>
	</div>
	<rich:dataTable width="100%" id="tableID" border="0"
		value="#{SubjectBB.answerlists}" var="table">
		<a4j:keepAlive beanName="SubjectBB" />
		<f:facet name="header">
			<rich:columnGroup>
				<rich:column style=" width:20% ">
					<h:outputText value="选择(正确答案勾选)" />
				</rich:column>
				<rich:column style=" width:10% ">
					<h:outputText value="选项（ABCD..）" />
				</rich:column>
				<rich:column>
					<h:outputText value="选项匹配答案" />
				</rich:column>
			</rich:columnGroup>
		</f:facet>
		<rich:columnGroup>
			<rich:column>
				<h:selectBooleanCheckbox value="#{table.select}"  style=" width:100% " />
			</rich:column>
			<rich:column>
				<h:inputText value="#{table.answercode}" style=" width:50% "/>
			</rich:column>
			<rich:column>
				<h:inputText value="#{table.answerdesc}" style=" width:100% " />
			</rich:column>
		</rich:columnGroup>
	</rich:dataTable></div>
	<div class="listbut">
		<h:commandButton styleClass="buttonbg" value="保存" action="#{SubjectBB.updateQuestion}" reRender="msgPanel" /> 
		<h:commandButton styleClass="buttonbg" value="返回" action="#{SubjectBB.toBack}" reRender="msgPanel" immediate="true"/>
		<a4j:commandButton styleClass="buttonbg2" action="#{SubjectBB.addAnswerlist}" value="追加备选答案" rendered="#{SubjectBB.addAnswer}" reRender="tableID,msgPanel"/>
		<a4j:commandButton styleClass="buttonbg2" action="#{SubjectBB.deleteAnswerlist}" value="移除备选答案" rendered="#{SubjectBB.addAnswer}" reRender="tableID,msgPanel"/></div>
	</div>
	</div>
</h:form>

</body>
</html>

